#include<iostream>
using namespace std;
typedef long long LL;
const int N = 2e5 + 10;
const LL mod = 1e9 + 7;
int n;
int main()
{
	cin >> n;
	LL ans = 0;
	LL sum = 0;
	for (int i = 1; i <= n; i++) {
		int x;
		scanf_s("%d", &x);
		ans += x * sum;
		ans %= mod;
		sum += x;
		sum %= mod;
	}
	cout << ans << endl;
	return 0;
}